package org.nox.helloseries.server.services.recherche.impl;

import org.nox.helloseries.domain.recherche.RetourRechercheTracker;
import org.nox.helloseries.factory.HelloSeriesServiceFactory;
import org.nox.helloseries.rest.client.recherche.RESTRechercheService;
import org.nox.helloseries.server.services.recherche.TrackerSearchService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DefaultTrackerSearchService implements TrackerSearchService
{
    private static final Logger LOG = LoggerFactory.getLogger( TrackerSearchService.class );

    // Import du client Rest
    private RESTRechercheService restRechercheService = HelloSeriesServiceFactory.createOrGetService( RESTRechercheService.class );

    public RetourRechercheTracker searchAll()
    {
        LOG.info( "Appel au service distant de récupération des séries" );
        RetourRechercheTracker retour = restRechercheService.searchAll();
        if ( retour != null )
        {
            LOG.info( "{} séries à télécharger", retour.getSeriesToBeDownloaded().size() );
        }
        return retour;
    }

}
